--
-- Author: shunguo.chen
-- Date: 2016-06-22 12:12:11
--
-- GoldRender 对 diamnum_node.csb 的解析

local ClassRef = app.mvc.createRenderClass(...)

-- data = num
function ClassRef.createWithData(data, node)
	local sprite = ClassRef.extend(node or cc.CSLoader:createNode("diamnum_node.csb"))
	if node == nil then
		ccui.Helper:doLayout(sprite)
	end
	sprite:init(data)
	return sprite
end

function ClassRef.create(node)
	local sprite = ClassRef.extend(node or cc.CSLoader:createNode("diamnum_node.csb"))
	if node == nil then
		ccui.Helper:doLayout(sprite)
	end
	sprite:init()
	return sprite
end

function ClassRef:init(data)
	self.super.init(self, data)

	self._text = self:findChild("coin_whole/num_bj/coin_num")
	self:refresh()
end

function ClassRef:refresh()
	if self._data then
		self:setText(self._data)
	end
end

function ClassRef:setText(text)
	self._text:setString(text or 0)
end

return ClassRef